#include "BoardView.h"

#include <boost/bind.hpp>
#include "../../../utils/LateEvents.hpp"

using namespace Views::Graphic;
using namespace Views::Helpers::Graphic::Deduction;
using namespace Utils;

BoardView::BoardView(GUI::Form* form):
BaseGraphicView(form), room_pick_dialog(NULL)
{
}

void BoardView::askForPlayerNewPosition(Players::Player* player, Cards::RoomsCards rooms_cards)
{
	room_pick_dialog = new RoomPickDialog(rooms_cards);
	room_pick_dialog->Move(50, 50);
	room_pick_dialog->doOnCardPick(LateAppLoopEventFactory::create(&BoardView::onButtonClick, this));
	Form->addChild(room_pick_dialog);
	Form->Draw(true);
}

void BoardView::onButtonClick(Cards::RoomCard* card)
{
	delete room_pick_dialog;
	room_pick_dialog = NULL;
	playerRoomChangeEvent(card->room);
}

